<?php
    include_once("../funcoes/session.php");
    
    $objSession = new Session();
    
    if(isset($_POST['logar'])){
        $usuario = $_POST['usu'];
        $senha = $_POST['senha'];
        
        if(empty($usuario)){
            echo "<script>alert('Informe o Usuario!')</script>";
        }elseif(empty($senha)){
            echo "<script>alert('Informe a Senha!')</script>";
        }else{
            if($objSession->login($usuario, $senha)){
                header("Location: dashboard.php");
//                if($_SESSION['nivel'] == 1){
//                    header("Location: dashboard.php");
//                }elseif($_SESSION['nivel'] == 2){
//                    header("Location: dashboard.php");
//                }elseif($_SESSION['nivel'] == 3){
//                    header("Location: osZelador.php");
//                }elseif($_SESSION['nivel'] == 4){
//                    header("Location: osFuncionario.php");
//                }
                
            }else{
                echo "<script>alert('Usuario e/ou Senha Inválidos!')</script>";
            }
        }
    }
?>
<html>
<head>
	<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
		<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
		<title>::: SOS UNITAU -- Sistema de ordem de serviço</title>
        	<link rel="shortcut icon" href="img/logo.jpg">
</head>
<style>
* {
box-sizing: border-box;
}

*:focus {
	outline: none;
}
body {
font-family: Arial;
background-color: #023a7;
padding: 50px;
}
.login {
margin: 10px auto;
width: 300px;
}
.login-screen {
background-color: #FFF;
padding: 20px;
border-radius: 5px;
border: solid 1px;
border-color: #ECF0F1;
}

.app-title {
text-align: center;
color: #777;
}

.login-form {
text-align: center;
}
.control-group {
margin-bottom: 10px;
}

input {
text-align: center;
background-color: #ECF0F1;
border: 2px solid transparent;
border-radius: 3px;
font-size: 16px;
font-weight: 200;
padding: 10px 0;
width: 250px;
transition: border .5s;
}

input:focus {
border: 2px solid #3498DB;
box-shadow: none;
}

.btn {
  border: 2px solid transparent;
  background: #3498DB;
  color: #ffffff;
  font-size: 16px;
  line-height: 25px;
  padding: 10px 0;
  text-decoration: none;
  text-shadow: none;
  border-radius: 3px;
  box-shadow: none;
  transition: 0.25s;
  display: block;
  width: 250px;
  margin: 0 auto;
}

.btn:hover {
  background-color: #2980B9;
}

.login-link {
  font-size: 12px;
  color: #444;
  display: block;
	margin-top: 12px;
}
.logo{
	margin:0 auto;	
        text-align: center;
}

#principal{
    width: 900px;
    height: 500px;
    margin: 0 auto;
}



</style>
<body>
    <div id="principal"> 
    <div class="logo"><img src="img/fundo-logo.png" width="180" height="180"></div>
    <form name="login" id="login" action="login.php" method="post">
	<div class="login">
		<div class="login-screen">
			<div class="app-title">
				<h1>SOS Unitau</h1>
			</div>

			<div class="login-form">
				<div class="control-group">
                                    <input type="text" name="usu" class="login-field" value="" placeholder="Usuário" id="login-name">
				<label class="login-field-icon fui-user" for="login-name"></label>
				</div>

				<div class="control-group">
                                    <input type="password" name="senha" class="login-field" value="" placeholder="Senha" id="login-pass">
				<label class="login-field-icon fui-lock" for="login-pass"></label>
				</div>

                            <input type="submit" name="logar" class="btn btn-primary btn-large btn-block" value="Login" />
				<a class="login-link" href="#">Esqueceu a senha?</a>
			</div>
		</div>
	</div>
    </form>
    </div>    
</body>